package com.zhr.tea.view.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.widget.RadioGroup;

import com.zhr.tea.R;
import com.zhr.tea.utils.FragmentTabUtils;
import com.zhr.tea.view.fragment.CarFragment;
import com.zhr.tea.view.fragment.DingZhiFragment;
import com.zhr.tea.view.fragment.FenLeiFragment;
import com.zhr.tea.view.fragment.MyFragment;
import com.zhr.tea.view.fragment.ShouYeFragment;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity implements FragmentTabUtils.OnRgsExtraCheckedChangedListener {


    RadioGroup mainRg;


    private ShouYeFragment shouye = ShouYeFragment.newInstance();
    private FenLeiFragment fenlei = FenLeiFragment.newInstance();
    private DingZhiFragment dingzhi = DingZhiFragment.newInstance();
    private CarFragment car = CarFragment.newInstance();
    private MyFragment my = MyFragment.newInstance();
    private List<Fragment> fragments;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mainRg = (RadioGroup) findViewById(R.id.main_rg);
        initView();
    }

    private void initView() {
        fragments = new ArrayList<>();
        fragments.add(shouye);
        fragments.add(fenlei);
        fragments.add(dingzhi);
        fragments.add(car);
        fragments.add(my);
        FragmentTabUtils utils = new FragmentTabUtils(getSupportFragmentManager(), fragments, R.id.main_frameLayout, mainRg, this);

    }

    @Override
    public void OnRgsExtraCheckedChanged(RadioGroup radioGroup, int checkedId, int index) {

    }
}
